<template>
  <div>
    <h2>{{title}}</h2>
    <p>姓名：{{name}}</p>
    <p>年龄：{{age}}</p>
    <button @click="$emit('input','组件B')">传值父组件</button>
  </div>
</template>

<script>
export default {
    data() {
        return {
            name: "Hydra",
            age: 35
        }
    },
    props: {
        title: {
            type: String,
            default: "默认标题"
        }
    }
}
</script>

<style scoped>
    h2 {
        color: #0f0;
    }

    p {
        padding: 5px;
        width: 200px;
        border: 1px solid #0f0;
    }
</style>